package com.share.controller;

import com.share.pojo.bo.BizAddressInfo;
import com.share.pojo.input.AddressQueryInput;
import com.share.pojo.input.AddressSaveInput;
import com.share.pojo.output.JsonResult;
import com.share.pojo.output.PageOutput;
import com.share.service.BizAddressService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * 合同controller
 *
 * @author liw
 * @version 1.0
 * @date 2022/8/13 11:10
 */
@ApiOperation("地址")
@RestController
@RequestMapping("address")
public class BizAddressController {

    @Autowired
    private BizAddressService bizAddressService;

    @PostMapping("info")
    @ApiOperation("新增")
    public JsonResult<Long> save(@RequestHeader("token") String token, @Valid @RequestBody AddressSaveInput vo) {
        return bizAddressService.save(vo);
    }

    @GetMapping("list")
    @ApiOperation("查询列表")
    public JsonResult<PageOutput<BizAddressInfo>> queryList(@RequestHeader("token") String token) {
        return bizAddressService.queryList();
    }

    @GetMapping("list/all")
    @ApiOperation("查询总列表")
    public JsonResult<PageOutput<BizAddressInfo>> queryListAll(@RequestHeader("token") String token, @Valid AddressQueryInput vo) {
        return bizAddressService.queryListAll(vo);
    }


}
